package com.leo.service.impl;


import com.leo.mapper.EmployeeMapper;
import com.leo.pojo.Employee;
import com.leo.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    public EmployeeMapper employeeMapper;

    @Override
    public void save(Employee employee) {
        employeeMapper.addEmployee(employee);
    }

    @Override
    public Employee getEmployeeById(Integer id) {
        Employee employee = employeeMapper.getEmployeeById(id);
        return employee;
    }

    @Override
    public void delete(Integer id) {
        employeeMapper.deleteById(id);
    }

    @Override
    public Collection<Employee> getAll() {
        Collection<Employee> collection = employeeMapper.getAll();
        return collection;
    }

    @Override
    public void update(Employee employee) {
        employeeMapper.update(employee);
    }
}
